
package com.opensymphony.clickstream;

// import java.util.List;
//
// import javax.servlet.http.Cookie;
// import javax.servlet.http.HttpServletRequest;
// import javax.servlet.http.HttpSession;
//
// import org.apache.commons.logging.Log;
// import org.apache.commons.logging.LogFactory;
// import org.springframework.web.context.WebApplicationContext;
// import org.springframework.web.context.support.WebApplicationContextUtils;
//
// import com.probiz.estore.webapp.util.RequestUtil;

/**
 * Descrption: add clicstream data to db,or get data from clickstream
 * createtime:2006-07-20
 * 
 * @author chenshangxuan
 * @version 1.0
 */
public class PersistClickStream {

	// public static void addClickStreamToDB(HttpSession session) {
	// if (session != null) {
	// Clickstream clickStream = (Clickstream)
	// session.getAttribute(Clickstream.USER_CLICKSTREAM);
	// if (clickStream != null) {
	//
	// UrlVisitedManager urlVisitedManager = null;
	// WebApplicationContext context = WebApplicationContextUtils
	// .getWebApplicationContext(session.getServletContext());
	//
	// urlVisitedManager = (UrlVisitedManager) context
	// .getBean("urlVisitedManager");
	// if (urlVisitedManager != null) {
	// List clickstreamList = clickStream.getStream();
	//                    
	// //batch update
	// urlVisitedManager.doBatchInsertClickstream(clickstreamList);
	//
	// clickStream.getStream().clear();
	// }
	// }
	// }
	// }
	//
	// public static List getClickStreamFromDb(HttpServletRequest request,
	// int topN, String cookieId) {
	//
	// UrlVisitedManager urlVisitedManager = null;
	// WebApplicationContext context = WebApplicationContextUtils
	// .getWebApplicationContext(request.getSession()
	// .getServletContext());
	// List clickstreamList = null;
	// urlVisitedManager = (UrlVisitedManager) context
	// .getBean("urlVisitedManager");
	// Cookie cookie = RequestUtil.getEStoreCookie(request);
	// if (urlVisitedManager != null) {
	// //load the user clickstream
	// //clickstreamList=urlVisitedManager.getTopNByCookieId(6,)
	// }
	// return clickstreamList;
	// }

}
